//
//  GkLiJWSettingViewController.swiftucbrpK
//  QRScan
//
//  Created by Qiang on 2018/3/25.
//  Copyright © 2018年 Qiang. All rights reserved.
//

import UIKit

class GkLiJWSettingViewController: UIViewController,UITableViewDataSource,UITableViewDelegate {


    @IBOutlet weak var tabbaview: UITableView!
    override func viewDidLoad() {
        super.viewDidLoad()

        self.title = "setting"
        self.tabbaview.separatorStyle = .none
        self.view.backgroundColor = UIColor.white
        // Do any additional setup after loading the view.
    }
    
    func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int {
        return 4
    }
    
    func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {
        let cell = UITableViewCell(style: .value1, reuseIdentifier: "cell")
        cell.selectionStyle = .none
        cell.imageView?.image = UIImage(named: ["JCHistoryIcon","about","share","Feedback"][indexPath.row])
        cell.accessoryType = .disclosureIndicator
        cell.textLabel?.text = ["History","About","Share","Feedback"][indexPath.row]
        let lingImgV = UIImageView(frame: CGRect(x: 20, y: 43.5, width: SCREEN_WIDTH, height: 0.5))
        lingImgV.backgroundColor = colorWithRGB(234, g: 234, b: 234, a: 1)
        cell.contentView.addSubview(lingImgV)
     
        
        return cell
        
    }
    func tableView(_ tableView: UITableView, didSelectRowAt indexPath: IndexPath) {
        if indexPath.row == 0 {
           self.hidesBottomBarWhenPushed = true
            self.navigationController?.pushViewController(RfppUcHistoryViewController(), animated: true)
            self.hidesBottomBarWhenPushed = false
        }
        if indexPath.row == 1 {
            let vc = WWXViewController()
            vc.webUrl = "https://www.jianshu.com/p/d2cc87ccab9c"
            self.hidesBottomBarWhenPushed = true
            self.navigationController?.pushViewController(vc, animated: true)
            self.hidesBottomBarWhenPushed = false
        }
        if indexPath.row == 2 {
            let activityViewController = UIActivityViewController(activityItems:
                ["itms-apps://itunes.apple.com/cn/app/id1364964489?mt=8"], applicationActivities:nil)
            
            let excludeActivities = [
                UIActivityType.postToWeibo,
                UIActivityType.assignToContact,
                UIActivityType.saveToCameraRoll,
                UIActivityType.addToReadingList,
                UIActivityType.postToFacebook,
                UIActivityType.postToTwitter,
                UIActivityType.copyToPasteboard]
            activityViewController.excludedActivityTypes = excludeActivities
            present(activityViewController, animated:true,      completion:nil)
        }
        if indexPath.row == 3 {
            self.hidesBottomBarWhenPushed = true
            self.navigationController?.pushViewController(ZAYPFfFeedBackViewController(), animated: true)
            self.hidesBottomBarWhenPushed = false
        }
        if indexPath.row == 5 {
             UIApplication.shared.openURL(NSURL(string: "itms-apps://itunes.apple.com/cn/app/id1364964489?mt=8")! as URL)
        }
      
  
    }

    override func didReceiveMemoryWarning() {
        super.didReceiveMemoryWarning()
        // Dispose of any resources that can be recreated.
    }
    

    /*
    // MARK: - Navigation

    // In a storyboard-based application, you will often want to do a little preparation before navigation
    override func prepare(for segue: UIStoryboardSegue, sender: Any?) {
        // Get the new view controller using segue.destinationViewController.
        // Pass the selected object to the new view controller.
    }
    */

}
